/**
 * Created by Administrator on 2020/5/8.
 */
;
//引入request请求库
var request = require("request");
var mysql = require("mysql");
var url = "https://www.allianz360.com/web-ah-backend/productView/determinePremium?1588906209086";
var payload = '{"ageLimit":{"ageTo":"14","ageFrom":"7"},"dayLimit":{"dayTo":"366","dayFrom":"366"},"planCode":"CZYXJASYP","planName":"优享计划","productCode":"HET-SHCZYX","productName":"成长优享-私立儿童门急诊保险（上海版）","day":"366"}';

//生成产品数据
function  genProductInfo( ) {
    plan = {


    }

}
//请求数据
function httpRequest( url,data ) {
    request({
        url:url,
        method:"POST",
        json:false,
        headers:{
            "content-type": "application/json"
        },
        body:data
        
    },function (error,res,body) {
        if(!error && res.statusCode == 200 ){
            console.log( JSON.parse( body ));
        }
        
    })
    
}
// 插入数据库
var connection = mysql.createConnection({
    host:"localhost",
    user:"root",
    password:"xuyanzhao",
    database:"product"
});
connection.connect();

connection.query("SELECT * FROM `medical`",function (err,rows,fields) {
    if (err){

        return;
    }
    console.log(rows);
    
});
